package cn.portx.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.bstek.bdf3.dorado.jpa.annotation.Generator;
import com.bstek.dorado.annotation.PropertyDef;

import cn.portx.policy.CreateUserPolicy;
import cn.portx.policy.CreatedDatePolicy;
import cn.portx.policy.IdGeneratorPolicy;

/**
 * Model class of 常用航线.
 * 
 * @author generated by ERMaster
 * @version $Id$
 */
@Entity
@Table(name = "T_COURSE")
public class Course extends BaseEntity {

	/** serialVersionUID. */
	private static final long serialVersionUID = 1L;

	/** 起始港ID. */
	@Column(name = "START_PORT_ID_", length = 60)
	@PropertyDef(label = "起始港ID", description = "起始港ID:起始港ID")
	private String startPortId;

	@Transient
	private Port startPort;

	/** 目的港ID. */
	@Column(name = "END_PORT_ID_", length = 60)
	@PropertyDef(label = "目的港ID", description = "目的港ID:目的港ID")
	private String endPortId;

	@Transient
	private Port endPort;

	/** 船舶ID. */
	@Column(name = "VESSEL_ID_", length = 60)
	@PropertyDef(label = "船舶ID", description = "船舶ID:船舶ID")
	private String vesselId;

	@Transient
	private Vessel vessel;

	/**
	 * Constructor.
	 */
	public Course() {
	}

	/**
	 * Set the 起始港ID.
	 * 
	 * @param startPortId
	 *            起始港ID
	 */
	public void setStartPortId(String startPortId) {
		this.startPortId = startPortId;
	}

	/**
	 * Get the 起始港ID.
	 * 
	 * @return 起始港ID
	 */
	public String getStartPortId() {
		return this.startPortId;
	}

	/**
	 * Set the 目的港ID.
	 * 
	 * @param endPortId
	 *            目的港ID
	 */
	public void setEndPortId(String endPortId) {
		this.endPortId = endPortId;
	}

	/**
	 * Get the 目的港ID.
	 * 
	 * @return 目的港ID
	 */
	public String getEndPortId() {
		return this.endPortId;
	}

	public Port getStartPort() {
		return startPort;
	}

	public void setStartPort(Port startPort) {
		this.startPort = startPort;
	}

	public Port getEndPort() {
		return endPort;
	}

	public void setEndPort(Port endPort) {
		this.endPort = endPort;
	}

	/**
	 * Set the 船舶ID.
	 * 
	 * @param vesselId
	 *            船舶ID
	 */
	public void setVesselId(String vesselId) {
		this.vesselId = vesselId;
	}

	/**
	 * Get the 船舶ID.
	 * 
	 * @return 船舶ID
	 */
	public String getVesselId() {
		return this.vesselId;
	}

	public Vessel getVessel() {
		return vessel;
	}

	public void setVessel(Vessel vessel) {
		this.vessel = vessel;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
		return result;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Course other = (Course) obj;
		if (this.getId() == null) {
			if (other.getId() != null) {
				return false;
			}
		} else if (!this.getId().equals(other.getId())) {
			return false;
		}
		return true;
	}

}
